#!/system/bin/sh
PROP_NAME="persist.sys.dataapk"
FIRST_RUN=$(getprop $PROP_NAME)
echo "[INST-APP] Check if all files in the /res/apk folder are installed" >> /cache/magisk.log
if [ ! -d "/res/apk" ]; then
    echo "[INST-APP] The /res/apk folder not exists.Stop Install"
    exit /b 0
fi
if [ "$FIRST_RUN" != "1" ]; then
echo "[INST-APP] Start Install" >> /cache/magisk.log
for file in /res/apk/*; do
if [ -f "$file" ]; then
pm install -r -t -d "$file" >> /cache/magisk.log
fi
done
setprop $PROP_NAME "1"
echo "[INST-APP] End of installation" >> /cache/magisk.log
echo "[INST-APP] This script is from [z][c][g][5][6][6][5]." >> /cache/magisk.log
else
echo "[INST-APP] Files in /res/apk have been installed" >> /cache/magisk.log
fi